<template>
  <div class="GlobalRank_content">
    <div class="GlobalRank_title">
      <p>全球榜</p>
    </div>
    <div class="GlobalRank_box">
      <div
        class="GlobalRank_body"
        v-for="(item, index) in rankList"
        :key="index"
      >
        <div class="GlobalRank_box_img">
          <img :src="item.coverImgUrl" alt="" />
          <div class="GlobalRank_box_upstate">
            <p>{{ item.updateFrequency }}</p>
          </div>
          <div class="GlobalRank_box_name">
            <span>{{ item.name }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      rankList: [],
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      this.$request("get", "/toplist").then((res) => {
        console.log("排行榜数据", res);
        this.rankList = res.list.slice(12, 19);
        console.log("截取精选排行榜数组", this.rankList);
      });
    },
  },
};
</script>
<style scoped>
.GlobalRank_content {
  margin: 10px 20px;
}
.GlobalRank_title > p {
  text-align: left;
  font-weight: 600;
}
.GlobalRank_box {
  background-color: white;
  border-radius: 1rem;
  display: flex;
  flex-wrap: wrap;
}
.GlobalRank_body {
  width: 30%;
  margin: 5px;
}
.GlobalRank_box_img {
  position: relative;
}

.GlobalRank_box_img > img {
  width: 100%;
  border-radius: 1rem;
}
.GlobalRank_box_upstate > p {
  font-size: 2px;
  position: absolute;
  right: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.162);
  color: white;
  margin-right: 3px;
  padding: 3px;
  border-radius: 1rem;
}
.GlobalRank_box_name {
  text-align: left;
}
.GlobalRank_box_name > span {
  font-size: 10px;
}
</style>

